﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class menu
    {
        
        public void Menu1()
        {
            int A = 0;
            menu me1 = new menu();
            do
            {
                Console.Clear();
                Console.WriteLine("2.hinh tru tron");
                Console.WriteLine("1.hinh lap phuong");
                Console.WriteLine("0.thoat");
                Console.Write("nhap lua chon: ");
                int B = Convert.ToInt16(Console.ReadLine());

                switch (B)
                {
                    case 1:
                        me1.Menu2LP();
                        break;
                    case 2:
                        me1.Menu2TT();
                        break;
                    case 0:
                        Environment.Exit(0);
                        break;

                }
            } while (A == 0);

        }
        public void Menu2TT()
        {
            Console.Clear();
            int A = 0;
            double KQ;
            CalculatorTT TT = new CalculatorTT();
            menu me2 = new menu();
            do
            {

                Console.WriteLine("3.dien tich toan phan");
                Console.WriteLine("2.the tich");
                Console.WriteLine("1.dien tich xung quang");
                Console.WriteLine("0.quay lai");
                Console.Write("nhap lua chon: ");
                int B = Convert.ToInt16(Console.ReadLine());
                TT.NhapDuLieu();
                switch (B)
                {
                    case 1:
                        KQ = TT.DienTichXungQuanh();
                        Console.WriteLine("dien tich xung quanh: {0}", KQ);
                        Console.ReadLine();
                        me2.Menu1();
                        break;
                    case 2:
                        KQ = TT.TheTich();
                        Console.WriteLine("the tich: {0}", KQ);
                        Console.ReadLine();
                        me2.Menu1();
                        break;
                    case 3:
                        KQ = TT.DienTichToanPhan();
                        Console.WriteLine("dien tich xung quanh: {0}", KQ);
                        Console.ReadLine();
                        me2.Menu1();
                        break;
                    case 0:
                        A++;
                        break;
                    default:
                        Console.WriteLine("lua chon cua ban");
                        break;
                }
            } while (A == 0);
        }
        public void Menu2LP()
        {
            menu me2 = new menu();
            CalculatorLP LP = new CalculatorLP();
            int A = 0;
            float KQ;
            do
            {
                Console.Clear();
                Console.WriteLine("3.dien tich toan phan");
                Console.WriteLine("2.the tich");
                Console.WriteLine("1.dien tich xung quanh");
                Console.WriteLine("0.quay lai");
                Console.Write("nhap lua chon: ");
                int B = Convert.ToInt16(Console.ReadLine());
                
                switch (B)
                {
                    case 1:
                        LP.NhapDuLieu();
                        KQ = LP.DienTichXungQuanh();
                        Console.WriteLine("dien tich xung quanh: {0}", KQ);
                        Console.ReadLine();
                        me2.Menu1();
                        break;
                    case 2:
                        LP.NhapDuLieu();
                        KQ = LP.TheTich();
                        Console.WriteLine("the tich: {0}", KQ);
                        Console.ReadLine();
                        me2.Menu1();
                        break;
                    case 3:
                        LP.NhapDuLieu();
                        KQ = LP.DienTichToanPhan();
                        Console.WriteLine("dien tich toan phan: {0}", KQ);
                        Console.ReadLine();
                        me2.Menu1();
                        break;
                    case 0:
                        A++;
                        break;
                    default:
                        Console.WriteLine("lua chon cua ban");
                        break;
                }
                

            } while (A == 0);
        }
    }
}
